//
//  B_MyJoinActivityVC.m
//  DreamOf
//
//  Created by 薛小刚 on 2018/8/23.
//  Copyright © 2018年 薛小刚. All rights reserved.
//

#import "B_MyJoinActivityVC.h"
#import "B_JoinActivityHeaderView.h"
#import "B_JoinActivityTVC.h"
#import "B_JoinActivityFooterView.h"
#import "B_JoinFooterViewTwo.h"

@interface B_MyJoinActivityVC ()
@property (nonatomic, strong) BaseTableView * mainView;

@end

@implementation B_MyJoinActivityVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"报名的活动"];
    self.view = self.mainView;
}



- (BaseTableView *)mainView {
    if (!_mainView) {
        WeakSelf(weSelf, self);
        _mainView = [[BaseTableView alloc] init];
        [_mainView setTableViewFrameWithTop:5 left:0 right:0 bottom:0];
        [_mainView.tableView registerNib:[UINib nibWithNibName:@"B_JoinActivityTVC" bundle:nil] forCellReuseIdentifier:@"B_JoinActivityTVC"];
        /// 组数
        _mainView.numberOfSectionsBlock = ^NSInteger(UITableView *tableView) {
            return 2;
        };
        /// 组里的个数
        _mainView.numberOfRowsBlock = ^NSInteger(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                return 0;
            }
            return 4;
        };
        _mainView.heightForHeaderBlock = ^CGFloat(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                return 105;
            }
            return 0.1;
        };
        _mainView.viewForHeaderBlock = ^UIView *(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                B_JoinActivityHeaderView * view = [B_JoinActivityHeaderView initB_JoinActivityHeaderView];
                view.B_activityImageView.backgroundColor = [UIColor redColor];
                view.B_activityTitle.text = @"相约周末, 美食小吃才艺展示活动";
                view.B_activityTimeLabel.text = @"2018-09-10";
                view.B_activityStatusLabel.text = @"进行中";
                return view;
            }
            return nil;
        };
        _mainView.heightForFooterBlock = ^CGFloat(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                return 44;
            }
            return 200;
        };
        _mainView.viewForFooterBlock = ^UIView *(UITableView *tableView, NSInteger section) {
            if (section == 0) {
                B_JoinActivityFooterView * footer = [B_JoinActivityFooterView initB_JoinActivityFooterView];
                footer.B_titleLabel.text = @"报名信息";
                return footer;
            } else {
                B_JoinFooterViewTwo * two = [B_JoinFooterViewTwo initB_JoinFooterViewTwo];
                two.B_EWMImageView.backgroundColor = [UIColor redColor];
                two.B_titleLabel.text = @"参与活动是出示该二维码";
                two.B_descriptionLabel.text = @"活动报名成功以后, 如未准时参加, 请在一个月内申请退款. 过期作废. ";
                return two;
            }
           
        };
        _mainView.heightForRowBlock = ^CGFloat(UITableView *tableView, NSIndexPath *indexPath) {
            return 44;
        };
        _mainView.cellForRowBlock = ^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath) {
            ///TODO:在这里取模型赋值
            B_JoinActivityTVC * cell = [tableView dequeueReusableCellWithIdentifier:@"B_JoinActivityTVC" forIndexPath:indexPath];
            cell.B_keyLabel.text = @"xingming:";
            cell.B_valueLabel.text = @"易小川";
            return cell;
        };
        _mainView.didSelectRow = ^(UITableView *tableView, NSIndexPath *indexPath) {
            
            
        };
    }
    return _mainView;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
